<?php
/**
 * 活动中奖纪录
 */
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateActivityRecordsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('activity_records', function (Blueprint $table) {
            $table->uuid('id')->unique();
            $table->uuid('activity_id');//活动id
            $table->uuid('prize_id')->nullable();//奖品id
            $table->string('name',30)->default('');
            $table->string('mobile',12)->default('');
            $table->string('address',255)->default('');
            $table->string('alipay',255)->default('');
            $table->string('openid')->default('');
            $table->integer('number')->default(1);//中奖个数
            $table->float('amount')->default(0);//中奖金额
            $table->string('coupon',255)->default('');//优惠卷码
            $table->integer('is_exchange')->default(0);//是否兑奖 0否 1是
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('activity_records', function (Blueprint $table) {
            $table->dropIfExists();
        });
    }
}
